<div class="box-tools" style="top:10px;">
  <form class="form-inline" id="project—form" action="{:url('Money/detailForExtend')}" method="get" pjax-search="">
    <div class="form-group">
      <label for="start_date">开始时间</label>
      <input class="form-control timepicker" autocomplete="off" id="start_date" name="start_date"
             value="{:input('get.start_date')}" placeholder="{$Think.lang.start_date}">
    </div>
    <div class="form-group">
      <label for="end_date">结束时间</label>
      <input class="form-control timepicker" autocomplete="off" id="end_date" name="end_date"
             value="{:input('get.end_date')}" placeholder="{$Think.lang.end_date}">
    </div>
    <div class="form-group">
      <label for="status">类型</label>
      <select class="form-control" name="status" id="status" style="border-radius:3px;width:150px;">
          <option value="0">全部</option>
          <option value="1" {if condition="  input('get.status') eq 1 "} selected="selected" {/if}>充值</option>
          <option value="2" {if condition="  input('get.status') eq 2 "} selected="selected" {/if}>发放</option>
          <option value="3" {if condition="  input('get.status') eq 3 "} selected="selected" {/if}>结算</option>
      </select>
    </div>
    <div class="form-group">
      <input type="submit" class="btn btn-primary" value="搜索">
      <button type="button" id="dwonload" class="btn btn-primary">下载</button>
      <button type="button" class="btn btn-primary" onclick="resetForm()">重置</button>
    </div>
  </form>
</div>
<script>
    $(function () {
        $('#dwonload').click(function () {
            var url = "{:url('Money/detailForExtend')}";
            var status = $("select[name='status']").val();
            var start_date = $("input[name='start_date']").val();
            var end_date = $("input[name='end_date']").val();
            location.href = url + "?status=" + status + "&start_date=" + start_date + "&end_date=" + end_date + "&down=1";
        })
        let start_date = $('#start_date').datetimepicker({
            format: 'YYYY-MM-DD',
            locale: moment.locale('zh-cn')
        });
        let end_date = $('#end_date').datetimepicker({
            format: 'YYYY-MM-DD',
            locale: moment.locale('zh-cn')
        });
        //动态设置最小值
        start_date.on('dp.change', function (e) {
           let initEndDate = $('#end_date').val()
            end_date.data('DateTimePicker').minDate(e.date);
            if(initEndDate === ''){
              $('#end_date').val('')
            }
        });
        //动态设置最大值
        end_date.on('dp.change', function (e) {
            start_date.data('DateTimePicker').maxDate(e.date);
        });
    })

    function resetForm() {
        $('select[name="status"]').val('0')
        $('input[name="start_date"]').val('')
        $('input[name="end_date"]').val('')
        $('#project—form').submit()
    }
</script>